#include "MallardDuck.h"
#include "ModelDuck.h"
#include "FlyRocketPowered.h"

void testCode() {
    //make_unique函数：动态分配指定类型的内存，并返回一个指向分配内存的唯一指针
    MallardDuck mallardDuck(std::make_unique<FlyWithWings>(),
            std::make_unique<Quack>());
    mallardDuck.performQuack();
    mallardDuck.performFly();

    ModelDuck modelDuck(std::make_unique<FlyNoWay>(),
            std::make_unique<Quack>());
    modelDuck.performFly();
    modelDuck.setFlyBehavior(std::make_unique<FlyRocketPowered>());
    modelDuck.performFly();


}

int main() {
    testCode();
    return 0;
}
